public class Account {
    String name;
    double balance=1000.0;
    public Account(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
    public double getBalance() {
        return balance;
    }
    public boolean put(double value){
        if(value>0) {
            balance+=value;
            System.out.println("存入后余额为"+balance);
            return true;
        }
        return false;
    }
    public double get(double value){
        if(value>balance) {
            System.out.println("余额不够");
            return 0;
        }
        else{
            balance-=value;
            System.out.println("取出金额后余额为"+balance);
        }
        return value;
    }
    public static void main(String[] args) {
        Account account1=new Account("xiaoli");
        double a=account1.getBalance();
        System.out.println("账户余额为"+a);
        account1.put(100.0);
        account1.get(150.0);    }
}








